package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.ParkingRuleDO;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;


public class ParkingRuleForm {

    @NotNull(message = "不能为空")
    private Long varId;
    @NotNull(message = "不能为空")
    @Pattern(regexp = "^([1-9]\\d*|0)(\\.\\d{1,2})?$",message = "最多2位数的小数")
    private String feeUnit;
    @NotNull(message = "不能为空")
    private Integer ruleStatus;
    @NotNull(message = "不能为空")
    private Long villageId;

    public Long getVillageId() {
        return villageId;
    }

    public void setVillageId(Long villageId) {
        this.villageId = villageId;
    }


    public ParkingRuleDO toDO() {
        ParkingRuleDO parkingRuleDO = new ParkingRuleDO();
        parkingRuleDO.setVarId(varId);
        parkingRuleDO.setRuleStatus(ruleStatus);
        parkingRuleDO.setFeeUnit(PriceUtil.convertPriceYuan(feeUnit));
        parkingRuleDO.setVillageId(villageId);
        return parkingRuleDO;
    }

    public Long getVarId() {
        return varId;
    }

    public void setVarId(Long varId) {
        this.varId = varId;
    }

    public String getFeeUnit() {
        return feeUnit;
    }

    public void setFeeUnit(String feeUnit) {
        this.feeUnit = feeUnit;
    }

    public Integer getRuleStatus() {
        return ruleStatus;
    }

    public void setRuleStatus(Integer ruleStatus) {
        this.ruleStatus = ruleStatus;
    }
}
